-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(PC-34083)[API] fix: pro: draft offer: always check if EAN is used #15965
base: master
Are you sure you want to change the base?
(PC-34083)[API] fix: pro: draft offer: always check if EAN is used #15965
Conversation
Visit the preview URL for this PR (updated for commit 7ec9126): https://pc-pro-testing--pr15965-pc-34083-block-pendi-i9lv1ws4.web.app (expires Thu, 30 Jan 2025 16:56:06 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 032d233ee67e1c50d6af12e29c936c7076770eb1 |
3b9f3e8
to
13184c1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tu peux clore cette PR parce que le check sur l'EAN est déjà fait dans check_offer_extra_data
.
100ff2a
to
7ec9126
Compare
Before publishing or updating a draft offer, the EAN should always be checked: if it is already used by another published (managed by the same venue), the edit or updated operation should fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deux petits retours à corriger sinon 👍🏻
class DraftOfferFactory(OfferFactory): | ||
isActive = False | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je crois qu'il faut que tu rajoutes cela pour que ta factory soit complète.
class DraftOfferFactory(OfferFactory): | |
isActive = False | |
class DraftOfferFactory(OfferFactory): | |
isActive = False | |
validation = OfferValidationStatus.DRAFT | |
if offer.extraData: | ||
if ean := offer.extraData.get(ExtraDataFieldEnum.EAN.value): | ||
validation.check_other_offer_with_ean_does_not_exist(ean, offer.venue, offer.id) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pour l'update je pense que tu peux enlever cette partie. Effectivement dans certain cas le check ne sera pas parfait (si on n'a pas changé les "extraData"
et que pourtant entre temps une offre a été publiée avec l'ean qui était dans l'extraData existant) mais ce n'est pas si grave.
Le plus important c'est de bloquer la publication de l'offre.
But de la pull request
Ticket Jira (ou description si BSR) : https://passculture.atlassian.net/browse/PC-34083
Avant
Sur le portail pro, il était possible d'éditer en de publier une offre en brouillon même si l'EAN était déjà utilisé par une offre publiée.
Pour l'offre en brouillon, il faut la créer, en publier une avec le même EAN et revenir dessus : il n'y a plus de vérification sur l'EAN.
Après
La vérification au niveau de l'EAN se fait au moment de la publication et de l'édition d'un brouillon d'offre, et plus seulement à sa création.